#region " using "
using System;
using System.Data;
using System.Web.UI.WebControls;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Threading;
using System.Globalization;
using System.Text;
using System.IO;
using Smarty;
using Data;
#endregion

public partial class Carticle_Search : AspNetRunnerPage
{
    int mypage = 1;
    int id = 1;
    string key;
    string templatefile = string.Empty;

    protected void Page_Init( object sender,  System.EventArgs e)  
    {
        strTableName = "article";
        strTableNameLocale = "article";
    }

    protected void Page_Load(object sender, EventArgs e)
    {
            // mandatory entry so compiler knows what table is processing
                        CheckSecurity();
            BuildForm();
            BuildBody();
            output.Append(func.BuildOutput(this, @"~\admin\article_search.aspx", smarty));

            this.Response.Write(output.ToString());
            this.Response.End();
    }

    private string GetIncludes()
    {
        StringBuilder includes = new StringBuilder();
		includes.Append("<script language=\"JavaScript\" src=\"include/calendar.js\"></script>\r\n");
        includes.Append("<script language=\"JavaScript\" src=\"include/jsfunctions.js\"></script>\r\n");
        includes.Append("<script language=\"JavaScript\" src=\"include/jquery.js\"></script>\r\n");
        if (useAJAX) 
        {
            includes.Append("<script language=\"JavaScript\" src=\"include/onthefly.js\"></script>\r\n");
            includes.Append("<script language=\"JavaScript\" src=\"include/ajaxsuggest.js\"></script>\r\n");
        }
        includes.Append("<script language=\"JavaScript\" type=\"text/javascript\">\r\n");
        includes.Append("var locale_dateformat = '" + Control.locale_info("LOCALE_IDATE", smarty) + "';\r\n");
        includes.Append("var locale_datedelimiter = \"" + Control.locale_info("LOCALE_SDATE", smarty) + "\";\r\n");
        includes.Append("var bLoading=false;\r\n");
        includes.Append("var TEXT_PLEASE_SELECT='" + Control.AddSlashes("Please select") + "';\r\n");
        if (useAJAX) 
        {
            includes.Append("var SUGGEST_TABLE = \"article_searchsuggest.aspx\";\r\n");
        }
	    includes.Append("var detect = navigator.userAgent.toLowerCase();");
        includes.Append("function checkIt(string)");
        includes.Append("{");
	    includes.Append("place = detect.indexOf(string) + 1;");
	    includes.Append("thestring = string;");
	    includes.Append("return place;");
        includes.Append("}");
        includes.Append("function ShowHideControls()");
        includes.Append("{");
	    includes.Append("document.getElementById('second_ArtID').style.display =  ");
		includes.Append("document.forms.editform.elements['asearchopt_ArtID'].value==\"Between\" ? '' : 'none'; ");
	    includes.Append("document.getElementById('second_ArtCateID').style.display =  ");
		includes.Append("document.forms.editform.elements['asearchopt_ArtCateID'].value==\"Between\" ? '' : 'none'; ");
	    includes.Append("document.getElementById('second_Title').style.display =  ");
		includes.Append("document.forms.editform.elements['asearchopt_Title'].value==\"Between\" ? '' : 'none'; ");
	    includes.Append("document.getElementById('second_ShortDescript').style.display =  ");
		includes.Append("document.forms.editform.elements['asearchopt_ShortDescript'].value==\"Between\" ? '' : 'none'; ");
	    includes.Append("document.getElementById('second_Content').style.display =  ");
		includes.Append("document.forms.editform.elements['asearchopt_Content'].value==\"Between\" ? '' : 'none'; ");
	    includes.Append("document.getElementById('second_Active').style.display =  ");
		includes.Append("document.forms.editform.elements['asearchopt_Active'].value==\"Between\" ? '' : 'none'; ");
	    includes.Append("document.getElementById('second_Status').style.display =  ");
		includes.Append("document.forms.editform.elements['asearchopt_Status'].value==\"Between\" ? '' : 'none'; ");
	    includes.Append("document.getElementById('second_VipLevel').style.display =  ");
		includes.Append("document.forms.editform.elements['asearchopt_VipLevel'].value==\"Between\" ? '' : 'none'; ");
	    includes.Append("document.getElementById('second_Viewed').style.display =  ");
		includes.Append("document.forms.editform.elements['asearchopt_Viewed'].value==\"Between\" ? '' : 'none'; ");
	    includes.Append("document.getElementById('second_Image').style.display =  ");
		includes.Append("document.forms.editform.elements['asearchopt_Image'].value==\"Between\" ? '' : 'none'; ");
	    includes.Append("document.getElementById('second_Author').style.display =  ");
		includes.Append("document.forms.editform.elements['asearchopt_Author'].value==\"Between\" ? '' : 'none'; ");
	    includes.Append("document.getElementById('second_Hot').style.display =  ");
		includes.Append("document.forms.editform.elements['asearchopt_Hot'].value==\"Between\" ? '' : 'none'; ");
	    includes.Append("document.getElementById('second_CreatedDate').style.display =  ");
		includes.Append("document.forms.editform.elements['asearchopt_CreatedDate'].value==\"Between\" ? '' : 'none'; ");
	    includes.Append("document.getElementById('second_UpdatedDate').style.display =  ");
		includes.Append("document.forms.editform.elements['asearchopt_UpdatedDate'].value==\"Between\" ? '' : 'none'; ");
	    includes.Append("return false;");
        includes.Append("}");
        includes.Append("function ResetControls()");
        includes.Append("{");
	    includes.Append("var i;");
	    includes.Append("e = document.forms[0].elements; ");
	    includes.Append("for (i=0;i<e.length;i++)"); 
	    includes.Append("{");
		includes.Append("if (e[i].name!='type' && e[i].className!='button' && e[i].type!='hidden')");
		includes.Append("{");
		includes.Append("if(e[i].type=='select-one')");
		includes.Append("e[i].selectedIndex=0;");
	    includes.Append("else if(e[i].type=='select-multiple')");
		includes.Append("{");
		includes.Append("var j;");
		includes.Append("for(j=0;j<e[i].options.length;j++)");
		includes.Append("e[i].options[j].selected=false;");
		includes.Append("}");
		includes.Append("else if(e[i].type=='checkbox' || e[i].type=='radio')");
		includes.Append("e[i].checked=false;");
	    includes.Append("else ");
		includes.Append("e[i].value = ''; ");
		includes.Append("}");
		includes.Append("else if(e[i].name.substr(0,6)=='value_' && e[i].type=='hidden')");
		includes.Append("e[i].value = ''; ");
	    includes.Append("}");
	    includes.Append("ShowHideControls();	");
	    includes.Append("return false;");
        includes.Append("}");

                includes.Append("$(document).ready(function() {");
	        includes.Append("document.forms.editform.value_ArtID.onkeyup=function(event) {searchSuggest(event,document.forms.editform.value_ArtID,'advanced')};");
	        includes.Append("document.forms.editform.value1_ArtID.onkeyup=function(event) {searchSuggest(event,document.forms.editform.value1_ArtID,'advanced1')};");
	        includes.Append("document.forms.editform.value_ArtID.onkeydown=function(event) {return listenEvent(event,document.forms.editform.value_ArtID,'advanced')};");
	        includes.Append("document.forms.editform.value1_ArtID.onkeydown=function(event) {return listenEvent(event,document.forms.editform.value1_ArtID,'advanced1')};");
	        includes.Append("document.forms.editform.value_Title.onkeyup=function(event) {searchSuggest(event,document.forms.editform.value_Title,'advanced')};");
	        includes.Append("document.forms.editform.value1_Title.onkeyup=function(event) {searchSuggest(event,document.forms.editform.value1_Title,'advanced1')};");
	        includes.Append("document.forms.editform.value_Title.onkeydown=function(event) {return listenEvent(event,document.forms.editform.value_Title,'advanced')};");
	        includes.Append("document.forms.editform.value1_Title.onkeydown=function(event) {return listenEvent(event,document.forms.editform.value1_Title,'advanced1')};");
	        includes.Append("document.forms.editform.value_ShortDescript.onkeyup=function(event) {searchSuggest(event,document.forms.editform.value_ShortDescript,'advanced')};");
	        includes.Append("document.forms.editform.value1_ShortDescript.onkeyup=function(event) {searchSuggest(event,document.forms.editform.value1_ShortDescript,'advanced1')};");
	        includes.Append("document.forms.editform.value_ShortDescript.onkeydown=function(event) {return listenEvent(event,document.forms.editform.value_ShortDescript,'advanced')};");
	        includes.Append("document.forms.editform.value1_ShortDescript.onkeydown=function(event) {return listenEvent(event,document.forms.editform.value1_ShortDescript,'advanced1')};");
	        includes.Append("document.forms.editform.value_Viewed.onkeyup=function(event) {searchSuggest(event,document.forms.editform.value_Viewed,'advanced')};");
	        includes.Append("document.forms.editform.value1_Viewed.onkeyup=function(event) {searchSuggest(event,document.forms.editform.value1_Viewed,'advanced1')};");
	        includes.Append("document.forms.editform.value_Viewed.onkeydown=function(event) {return listenEvent(event,document.forms.editform.value_Viewed,'advanced')};");
	        includes.Append("document.forms.editform.value1_Viewed.onkeydown=function(event) {return listenEvent(event,document.forms.editform.value1_Viewed,'advanced1')};");
	        includes.Append("document.forms.editform.value_Image.onkeyup=function(event) {searchSuggest(event,document.forms.editform.value_Image,'advanced')};");
	        includes.Append("document.forms.editform.value1_Image.onkeyup=function(event) {searchSuggest(event,document.forms.editform.value1_Image,'advanced1')};");
	        includes.Append("document.forms.editform.value_Image.onkeydown=function(event) {return listenEvent(event,document.forms.editform.value_Image,'advanced')};");
	        includes.Append("document.forms.editform.value1_Image.onkeydown=function(event) {return listenEvent(event,document.forms.editform.value1_Image,'advanced1')};");
	        includes.Append("document.forms.editform.value_Author.onkeyup=function(event) {searchSuggest(event,document.forms.editform.value_Author,'advanced')};");
	        includes.Append("document.forms.editform.value1_Author.onkeyup=function(event) {searchSuggest(event,document.forms.editform.value1_Author,'advanced1')};");
	        includes.Append("document.forms.editform.value_Author.onkeydown=function(event) {return listenEvent(event,document.forms.editform.value_Author,'advanced')};");
	        includes.Append("document.forms.editform.value1_Author.onkeydown=function(event) {return listenEvent(event,document.forms.editform.value1_Author,'advanced1')};");
        includes.Append("});");
        includes.Append("</script>");
        includes.Append("<div id=\"search_suggest\"></div>");

        return includes.ToString();
    }

    protected void BuildForm()
    {
        string all_checkbox="value=\"and\"";
        string any_checkbox="value=\"or\"";

        if(Asearchtype == "or")
        {
	        any_checkbox +=" checked";
        }
        else
        {
	        all_checkbox +=" checked";
        }
        smarty.Add("any_checkbox",any_checkbox);
        smarty.Add("all_checkbox",all_checkbox);

        IDictionary<string, string> editformats = new Dictionary<string, string>();
        string opt = "";
        bool not = false;
        string value = string.Empty;
        StringBuilder options = new StringBuilder();
        string searchtype = string.Empty;

        // ArtID 
        opt = "";
        not = false;
        value = string.Empty;
        searchtype = string.Empty;
        if(Search == 2)
        {
	        opt = Asearchopt["ArtID"];
	        not = Asearchnot["ArtID"];
	        value = Asearchfor["ArtID"];
        }

        Control control_ArtID = null;
        Control control1_ArtID = null;

        control_ArtID = new Control("ArtID", value, false, smarty, this.Request, builder, MODE.MODE_SEARCH);
        
        smarty.Add("ArtID_editcontrol", control_ArtID.BuildEditControl());
        control1_ArtID = new Control("ArtID", value, true, smarty, this.Request, builder, MODE.MODE_SEARCH);
                smarty.Add("ArtID_editcontrol1", control1_ArtID.BuildEditControl());

        IDictionary<string, string> ArtID_fieldblock = new Dictionary<string, string>();
	    ArtID_fieldblock["begin"] = "<input type=\"Hidden\" name=\"asearchfield[]\" value=\"ArtID\">";
	    ArtID_fieldblock["end"]=string.Empty;
	    smarty.Add("ArtID_fieldblock", ArtID_fieldblock);

        string ArtID_notbox="name=\"not_ArtID\"";
        if(not)
        {
	        ArtID_notbox +=" checked";
        }
        smarty.Add("ArtID_notbox",ArtID_notbox);

        //	write search options
        options = options.Remove(0, options.Length);
                options.Append("<OPTION VALUE=\"Contains\" " + ((opt=="Contains")?"selected":"") + ">" + "Contains" + "</option>");
        options.Append("<OPTION VALUE=\"Equals\" " + ((opt=="Equals")?"selected":"") + ">" + "Equals" + "</option>");
        options.Append("<OPTION VALUE=\"Starts with ...\" " + ((opt=="Starts with ...")?"selected":"") + ">" + "Starts with ..." + "</option>");
        options.Append("<OPTION VALUE=\"More than ...\" " + ((opt=="More than ...")?"selected":"") + ">" + "More than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Less than ...\" " + ((opt=="Less than ...")?"selected":"") + ">" + "Less than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Equal or more than ...\" " + ((opt=="Equal or more than ...")?"selected":"") + ">" + "Equal or more than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Equal or less than ...\" " + ((opt=="Equal or less than ...")?"selected":"") + ">" + "Equal or less than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Between\" " + ((opt=="Between")?"selected":"") + ">" + "Between" + "</option>");
        options.Append("<OPTION VALUE=\"Empty\" " + ((opt=="Empty")?"selected":"") + ">" + "Empty" + "</option>");
        searchtype = "<SELECT ID=\"SearchOption\" NAME=\"asearchopt_ArtID\" SIZE=1 onChange=\"return ShowHideControls();\">";
        searchtype += options.ToString();
        searchtype += "</SELECT>";
        smarty.Add("searchtype_ArtID", searchtype);
        //	edit format
                editformats["ArtID"] = "Text field";
        // ArtCateID 
        opt = "";
        not = false;
        value = string.Empty;
        searchtype = string.Empty;
        if(Search == 2)
        {
	        opt = Asearchopt["ArtCateID"];
	        not = Asearchnot["ArtCateID"];
	        value = Asearchfor["ArtCateID"];
        }

        Control control_ArtCateID = null;
        Control control1_ArtCateID = null;

        control_ArtCateID = new Control("ArtCateID", value, false, smarty, this.Request, builder, MODE.MODE_SEARCH);
                func.PopulateLookupFields(control_ArtCateID.FieldInfo);

        smarty.Add("ArtCateID_editcontrol", control_ArtCateID.BuildEditControl());
        control1_ArtCateID = new Control("ArtCateID", value, true, smarty, this.Request, builder, MODE.MODE_SEARCH);
                func.PopulateLookupFields(control1_ArtCateID.FieldInfo);
        smarty.Add("ArtCateID_editcontrol1", control1_ArtCateID.BuildEditControl());

        IDictionary<string, string> ArtCateID_fieldblock = new Dictionary<string, string>();
	    ArtCateID_fieldblock["begin"] = "<input type=\"Hidden\" name=\"asearchfield[]\" value=\"ArtCateID\">";
	    ArtCateID_fieldblock["end"]=string.Empty;
	    smarty.Add("ArtCateID_fieldblock", ArtCateID_fieldblock);

        string ArtCateID_notbox="name=\"not_ArtCateID\"";
        if(not)
        {
	        ArtCateID_notbox +=" checked";
        }
        smarty.Add("ArtCateID_notbox",ArtCateID_notbox);

        //	write search options
        options = options.Remove(0, options.Length);
                options.Append("<OPTION VALUE=\"Equals\" " + ((opt=="Equals")?"selected":"") + ">" + "Equals" + "</option>");
        searchtype = "<SELECT ID=\"SearchOption\" NAME=\"asearchopt_ArtCateID\" SIZE=1 onChange=\"return ShowHideControls();\">";
        searchtype += options.ToString();
        searchtype += "</SELECT>";
        smarty.Add("searchtype_ArtCateID", searchtype);
        //	edit format
                editformats["ArtCateID"] = "Lookup wizard";
        // Title 
        opt = "";
        not = false;
        value = string.Empty;
        searchtype = string.Empty;
        if(Search == 2)
        {
	        opt = Asearchopt["Title"];
	        not = Asearchnot["Title"];
	        value = Asearchfor["Title"];
        }

        Control control_Title = null;
        Control control1_Title = null;

        control_Title = new Control("Title", value, false, smarty, this.Request, builder, MODE.MODE_SEARCH);
        
        smarty.Add("Title_editcontrol", control_Title.BuildEditControl());
        control1_Title = new Control("Title", value, true, smarty, this.Request, builder, MODE.MODE_SEARCH);
                smarty.Add("Title_editcontrol1", control1_Title.BuildEditControl());

        IDictionary<string, string> Title_fieldblock = new Dictionary<string, string>();
	    Title_fieldblock["begin"] = "<input type=\"Hidden\" name=\"asearchfield[]\" value=\"Title\">";
	    Title_fieldblock["end"]=string.Empty;
	    smarty.Add("Title_fieldblock", Title_fieldblock);

        string Title_notbox="name=\"not_Title\"";
        if(not)
        {
	        Title_notbox +=" checked";
        }
        smarty.Add("Title_notbox",Title_notbox);

        //	write search options
        options = options.Remove(0, options.Length);
                options.Append("<OPTION VALUE=\"Contains\" " + ((opt=="Contains")?"selected":"") + ">" + "Contains" + "</option>");
        options.Append("<OPTION VALUE=\"Equals\" " + ((opt=="Equals")?"selected":"") + ">" + "Equals" + "</option>");
        options.Append("<OPTION VALUE=\"Starts with ...\" " + ((opt=="Starts with ...")?"selected":"") + ">" + "Starts with ..." + "</option>");
        options.Append("<OPTION VALUE=\"More than ...\" " + ((opt=="More than ...")?"selected":"") + ">" + "More than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Less than ...\" " + ((opt=="Less than ...")?"selected":"") + ">" + "Less than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Equal or more than ...\" " + ((opt=="Equal or more than ...")?"selected":"") + ">" + "Equal or more than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Equal or less than ...\" " + ((opt=="Equal or less than ...")?"selected":"") + ">" + "Equal or less than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Between\" " + ((opt=="Between")?"selected":"") + ">" + "Between" + "</option>");
        options.Append("<OPTION VALUE=\"Empty\" " + ((opt=="Empty")?"selected":"") + ">" + "Empty" + "</option>");
        searchtype = "<SELECT ID=\"SearchOption\" NAME=\"asearchopt_Title\" SIZE=1 onChange=\"return ShowHideControls();\">";
        searchtype += options.ToString();
        searchtype += "</SELECT>";
        smarty.Add("searchtype_Title", searchtype);
        //	edit format
                editformats["Title"] = "Text field";
        // ShortDescript 
        opt = "";
        not = false;
        value = string.Empty;
        searchtype = string.Empty;
        if(Search == 2)
        {
	        opt = Asearchopt["ShortDescript"];
	        not = Asearchnot["ShortDescript"];
	        value = Asearchfor["ShortDescript"];
        }

        Control control_ShortDescript = null;
        Control control1_ShortDescript = null;

        control_ShortDescript = new Control("ShortDescript", value, false, smarty, this.Request, builder, MODE.MODE_SEARCH);
        
        smarty.Add("ShortDescript_editcontrol", control_ShortDescript.BuildEditControl());
        control1_ShortDescript = new Control("ShortDescript", value, true, smarty, this.Request, builder, MODE.MODE_SEARCH);
                smarty.Add("ShortDescript_editcontrol1", control1_ShortDescript.BuildEditControl());

        IDictionary<string, string> ShortDescript_fieldblock = new Dictionary<string, string>();
	    ShortDescript_fieldblock["begin"] = "<input type=\"Hidden\" name=\"asearchfield[]\" value=\"ShortDescript\">";
	    ShortDescript_fieldblock["end"]=string.Empty;
	    smarty.Add("ShortDescript_fieldblock", ShortDescript_fieldblock);

        string ShortDescript_notbox="name=\"not_ShortDescript\"";
        if(not)
        {
	        ShortDescript_notbox +=" checked";
        }
        smarty.Add("ShortDescript_notbox",ShortDescript_notbox);

        //	write search options
        options = options.Remove(0, options.Length);
                options.Append("<OPTION VALUE=\"Contains\" " + ((opt=="Contains")?"selected":"") + ">" + "Contains" + "</option>");
        options.Append("<OPTION VALUE=\"Equals\" " + ((opt=="Equals")?"selected":"") + ">" + "Equals" + "</option>");
        options.Append("<OPTION VALUE=\"Starts with ...\" " + ((opt=="Starts with ...")?"selected":"") + ">" + "Starts with ..." + "</option>");
        options.Append("<OPTION VALUE=\"More than ...\" " + ((opt=="More than ...")?"selected":"") + ">" + "More than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Less than ...\" " + ((opt=="Less than ...")?"selected":"") + ">" + "Less than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Equal or more than ...\" " + ((opt=="Equal or more than ...")?"selected":"") + ">" + "Equal or more than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Equal or less than ...\" " + ((opt=="Equal or less than ...")?"selected":"") + ">" + "Equal or less than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Between\" " + ((opt=="Between")?"selected":"") + ">" + "Between" + "</option>");
        options.Append("<OPTION VALUE=\"Empty\" " + ((opt=="Empty")?"selected":"") + ">" + "Empty" + "</option>");
        searchtype = "<SELECT ID=\"SearchOption\" NAME=\"asearchopt_ShortDescript\" SIZE=1 onChange=\"return ShowHideControls();\">";
        searchtype += options.ToString();
        searchtype += "</SELECT>";
        smarty.Add("searchtype_ShortDescript", searchtype);
        //	edit format
                editformats["ShortDescript"] = "Text field";
        // Content 
        opt = "";
        not = false;
        value = string.Empty;
        searchtype = string.Empty;
        if(Search == 2)
        {
	        opt = Asearchopt["Content"];
	        not = Asearchnot["Content"];
	        value = Asearchfor["Content"];
        }

        Control control_Content = null;
        Control control1_Content = null;

        control_Content = new Control("Content", value, false, smarty, this.Request, builder, MODE.MODE_SEARCH);
        
        smarty.Add("Content_editcontrol", control_Content.BuildEditControl());
        control1_Content = new Control("Content", value, true, smarty, this.Request, builder, MODE.MODE_SEARCH);
                smarty.Add("Content_editcontrol1", control1_Content.BuildEditControl());

        IDictionary<string, string> Content_fieldblock = new Dictionary<string, string>();
	    Content_fieldblock["begin"] = "<input type=\"Hidden\" name=\"asearchfield[]\" value=\"Content\">";
	    Content_fieldblock["end"]=string.Empty;
	    smarty.Add("Content_fieldblock", Content_fieldblock);

        string Content_notbox="name=\"not_Content\"";
        if(not)
        {
	        Content_notbox +=" checked";
        }
        smarty.Add("Content_notbox",Content_notbox);

        //	write search options
        options = options.Remove(0, options.Length);
                options.Append("<OPTION VALUE=\"Contains\" " + ((opt=="Contains")?"selected":"") + ">" + "Contains" + "</option>");
        options.Append("<OPTION VALUE=\"Equals\" " + ((opt=="Equals")?"selected":"") + ">" + "Equals" + "</option>");
        options.Append("<OPTION VALUE=\"Starts with ...\" " + ((opt=="Starts with ...")?"selected":"") + ">" + "Starts with ..." + "</option>");
        options.Append("<OPTION VALUE=\"More than ...\" " + ((opt=="More than ...")?"selected":"") + ">" + "More than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Less than ...\" " + ((opt=="Less than ...")?"selected":"") + ">" + "Less than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Equal or more than ...\" " + ((opt=="Equal or more than ...")?"selected":"") + ">" + "Equal or more than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Equal or less than ...\" " + ((opt=="Equal or less than ...")?"selected":"") + ">" + "Equal or less than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Between\" " + ((opt=="Between")?"selected":"") + ">" + "Between" + "</option>");
        options.Append("<OPTION VALUE=\"Empty\" " + ((opt=="Empty")?"selected":"") + ">" + "Empty" + "</option>");
        searchtype = "<SELECT ID=\"SearchOption\" NAME=\"asearchopt_Content\" SIZE=1 onChange=\"return ShowHideControls();\">";
        searchtype += options.ToString();
        searchtype += "</SELECT>";
        smarty.Add("searchtype_Content", searchtype);
        //	edit format
                editformats["Content"] = "EDIT_FORMAT_TEXT_FIELD";
        // Active 
        opt = "";
        not = false;
        value = string.Empty;
        searchtype = string.Empty;
        if(Search == 2)
        {
	        opt = Asearchopt["Active"];
	        not = Asearchnot["Active"];
	        value = Asearchfor["Active"];
        }

        Control control_Active = null;
        Control control1_Active = null;

        control_Active = new Control("Active", value, false, smarty, this.Request, builder, MODE.MODE_SEARCH);
        
        smarty.Add("Active_editcontrol", control_Active.BuildEditControl());
        control1_Active = new Control("Active", value, true, smarty, this.Request, builder, MODE.MODE_SEARCH);
                smarty.Add("Active_editcontrol1", control1_Active.BuildEditControl());

        IDictionary<string, string> Active_fieldblock = new Dictionary<string, string>();
	    Active_fieldblock["begin"] = "<input type=\"Hidden\" name=\"asearchfield[]\" value=\"Active\">";
	    Active_fieldblock["end"]=string.Empty;
	    smarty.Add("Active_fieldblock", Active_fieldblock);

        string Active_notbox="name=\"not_Active\"";
        if(not)
        {
	        Active_notbox +=" checked";
        }
        smarty.Add("Active_notbox",Active_notbox);

        //	write search options
        options = options.Remove(0, options.Length);
                options.Append("<OPTION VALUE=\"Equals\" " + ((opt=="Equals")?"selected":"") + ">" + "Equals" + "</option>");
        searchtype = "<SELECT ID=\"SearchOption\" NAME=\"asearchopt_Active\" SIZE=1 onChange=\"return ShowHideControls();\">";
        searchtype += options.ToString();
        searchtype += "</SELECT>";
        smarty.Add("searchtype_Active", searchtype);
        //	edit format
                editformats["Active"] = "Lookup wizard";
        // Status 
        opt = "";
        not = false;
        value = string.Empty;
        searchtype = string.Empty;
        if(Search == 2)
        {
	        opt = Asearchopt["Status"];
	        not = Asearchnot["Status"];
	        value = Asearchfor["Status"];
        }

        Control control_Status = null;
        Control control1_Status = null;

        control_Status = new Control("Status", value, false, smarty, this.Request, builder, MODE.MODE_SEARCH);
        
        smarty.Add("Status_editcontrol", control_Status.BuildEditControl());
        control1_Status = new Control("Status", value, true, smarty, this.Request, builder, MODE.MODE_SEARCH);
                smarty.Add("Status_editcontrol1", control1_Status.BuildEditControl());

        IDictionary<string, string> Status_fieldblock = new Dictionary<string, string>();
	    Status_fieldblock["begin"] = "<input type=\"Hidden\" name=\"asearchfield[]\" value=\"Status\">";
	    Status_fieldblock["end"]=string.Empty;
	    smarty.Add("Status_fieldblock", Status_fieldblock);

        string Status_notbox="name=\"not_Status\"";
        if(not)
        {
	        Status_notbox +=" checked";
        }
        smarty.Add("Status_notbox",Status_notbox);

        //	write search options
        options = options.Remove(0, options.Length);
                options.Append("<OPTION VALUE=\"Equals\" " + ((opt=="Equals")?"selected":"") + ">" + "Equals" + "</option>");
        searchtype = "<SELECT ID=\"SearchOption\" NAME=\"asearchopt_Status\" SIZE=1 onChange=\"return ShowHideControls();\">";
        searchtype += options.ToString();
        searchtype += "</SELECT>";
        smarty.Add("searchtype_Status", searchtype);
        //	edit format
                editformats["Status"] = "Lookup wizard";
        // VipLevel 
        opt = "";
        not = false;
        value = string.Empty;
        searchtype = string.Empty;
        if(Search == 2)
        {
	        opt = Asearchopt["VipLevel"];
	        not = Asearchnot["VipLevel"];
	        value = Asearchfor["VipLevel"];
        }

        Control control_VipLevel = null;
        Control control1_VipLevel = null;

        control_VipLevel = new Control("VipLevel", value, false, smarty, this.Request, builder, MODE.MODE_SEARCH);
        
        smarty.Add("VipLevel_editcontrol", control_VipLevel.BuildEditControl());
        control1_VipLevel = new Control("VipLevel", value, true, smarty, this.Request, builder, MODE.MODE_SEARCH);
                smarty.Add("VipLevel_editcontrol1", control1_VipLevel.BuildEditControl());

        IDictionary<string, string> VipLevel_fieldblock = new Dictionary<string, string>();
	    VipLevel_fieldblock["begin"] = "<input type=\"Hidden\" name=\"asearchfield[]\" value=\"VipLevel\">";
	    VipLevel_fieldblock["end"]=string.Empty;
	    smarty.Add("VipLevel_fieldblock", VipLevel_fieldblock);

        string VipLevel_notbox="name=\"not_VipLevel\"";
        if(not)
        {
	        VipLevel_notbox +=" checked";
        }
        smarty.Add("VipLevel_notbox",VipLevel_notbox);

        //	write search options
        options = options.Remove(0, options.Length);
                options.Append("<OPTION VALUE=\"Equals\" " + ((opt=="Equals")?"selected":"") + ">" + "Equals" + "</option>");
        searchtype = "<SELECT ID=\"SearchOption\" NAME=\"asearchopt_VipLevel\" SIZE=1 onChange=\"return ShowHideControls();\">";
        searchtype += options.ToString();
        searchtype += "</SELECT>";
        smarty.Add("searchtype_VipLevel", searchtype);
        //	edit format
                editformats["VipLevel"] = "Lookup wizard";
        // Viewed 
        opt = "";
        not = false;
        value = string.Empty;
        searchtype = string.Empty;
        if(Search == 2)
        {
	        opt = Asearchopt["Viewed"];
	        not = Asearchnot["Viewed"];
	        value = Asearchfor["Viewed"];
        }

        Control control_Viewed = null;
        Control control1_Viewed = null;

        control_Viewed = new Control("Viewed", value, false, smarty, this.Request, builder, MODE.MODE_SEARCH);
        
        smarty.Add("Viewed_editcontrol", control_Viewed.BuildEditControl());
        control1_Viewed = new Control("Viewed", value, true, smarty, this.Request, builder, MODE.MODE_SEARCH);
                smarty.Add("Viewed_editcontrol1", control1_Viewed.BuildEditControl());

        IDictionary<string, string> Viewed_fieldblock = new Dictionary<string, string>();
	    Viewed_fieldblock["begin"] = "<input type=\"Hidden\" name=\"asearchfield[]\" value=\"Viewed\">";
	    Viewed_fieldblock["end"]=string.Empty;
	    smarty.Add("Viewed_fieldblock", Viewed_fieldblock);

        string Viewed_notbox="name=\"not_Viewed\"";
        if(not)
        {
	        Viewed_notbox +=" checked";
        }
        smarty.Add("Viewed_notbox",Viewed_notbox);

        //	write search options
        options = options.Remove(0, options.Length);
                options.Append("<OPTION VALUE=\"Contains\" " + ((opt=="Contains")?"selected":"") + ">" + "Contains" + "</option>");
        options.Append("<OPTION VALUE=\"Equals\" " + ((opt=="Equals")?"selected":"") + ">" + "Equals" + "</option>");
        options.Append("<OPTION VALUE=\"Starts with ...\" " + ((opt=="Starts with ...")?"selected":"") + ">" + "Starts with ..." + "</option>");
        options.Append("<OPTION VALUE=\"More than ...\" " + ((opt=="More than ...")?"selected":"") + ">" + "More than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Less than ...\" " + ((opt=="Less than ...")?"selected":"") + ">" + "Less than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Equal or more than ...\" " + ((opt=="Equal or more than ...")?"selected":"") + ">" + "Equal or more than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Equal or less than ...\" " + ((opt=="Equal or less than ...")?"selected":"") + ">" + "Equal or less than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Between\" " + ((opt=="Between")?"selected":"") + ">" + "Between" + "</option>");
        options.Append("<OPTION VALUE=\"Empty\" " + ((opt=="Empty")?"selected":"") + ">" + "Empty" + "</option>");
        searchtype = "<SELECT ID=\"SearchOption\" NAME=\"asearchopt_Viewed\" SIZE=1 onChange=\"return ShowHideControls();\">";
        searchtype += options.ToString();
        searchtype += "</SELECT>";
        smarty.Add("searchtype_Viewed", searchtype);
        //	edit format
                editformats["Viewed"] = "Text field";
        // Image 
        opt = "";
        not = false;
        value = string.Empty;
        searchtype = string.Empty;
        if(Search == 2)
        {
	        opt = Asearchopt["Image"];
	        not = Asearchnot["Image"];
	        value = Asearchfor["Image"];
        }

        Control control_Image = null;
        Control control1_Image = null;

        control_Image = new Control("Image", value, false, smarty, this.Request, builder, MODE.MODE_SEARCH);
        
        smarty.Add("Image_editcontrol", control_Image.BuildEditControl());
        control1_Image = new Control("Image", value, true, smarty, this.Request, builder, MODE.MODE_SEARCH);
                smarty.Add("Image_editcontrol1", control1_Image.BuildEditControl());

        IDictionary<string, string> Image_fieldblock = new Dictionary<string, string>();
	    Image_fieldblock["begin"] = "<input type=\"Hidden\" name=\"asearchfield[]\" value=\"Image\">";
	    Image_fieldblock["end"]=string.Empty;
	    smarty.Add("Image_fieldblock", Image_fieldblock);

        string Image_notbox="name=\"not_Image\"";
        if(not)
        {
	        Image_notbox +=" checked";
        }
        smarty.Add("Image_notbox",Image_notbox);

        //	write search options
        options = options.Remove(0, options.Length);
                options.Append("<OPTION VALUE=\"Contains\" " + ((opt=="Contains")?"selected":"") + ">" + "Contains" + "</option>");
        options.Append("<OPTION VALUE=\"Equals\" " + ((opt=="Equals")?"selected":"") + ">" + "Equals" + "</option>");
        options.Append("<OPTION VALUE=\"Starts with ...\" " + ((opt=="Starts with ...")?"selected":"") + ">" + "Starts with ..." + "</option>");
        options.Append("<OPTION VALUE=\"More than ...\" " + ((opt=="More than ...")?"selected":"") + ">" + "More than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Less than ...\" " + ((opt=="Less than ...")?"selected":"") + ">" + "Less than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Equal or more than ...\" " + ((opt=="Equal or more than ...")?"selected":"") + ">" + "Equal or more than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Equal or less than ...\" " + ((opt=="Equal or less than ...")?"selected":"") + ">" + "Equal or less than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Between\" " + ((opt=="Between")?"selected":"") + ">" + "Between" + "</option>");
        options.Append("<OPTION VALUE=\"Empty\" " + ((opt=="Empty")?"selected":"") + ">" + "Empty" + "</option>");
        searchtype = "<SELECT ID=\"SearchOption\" NAME=\"asearchopt_Image\" SIZE=1 onChange=\"return ShowHideControls();\">";
        searchtype += options.ToString();
        searchtype += "</SELECT>";
        smarty.Add("searchtype_Image", searchtype);
        //	edit format
                editformats["Image"] = "Text field";
        // Author 
        opt = "";
        not = false;
        value = string.Empty;
        searchtype = string.Empty;
        if(Search == 2)
        {
	        opt = Asearchopt["Author"];
	        not = Asearchnot["Author"];
	        value = Asearchfor["Author"];
        }

        Control control_Author = null;
        Control control1_Author = null;

        control_Author = new Control("Author", value, false, smarty, this.Request, builder, MODE.MODE_SEARCH);
        
        smarty.Add("Author_editcontrol", control_Author.BuildEditControl());
        control1_Author = new Control("Author", value, true, smarty, this.Request, builder, MODE.MODE_SEARCH);
                smarty.Add("Author_editcontrol1", control1_Author.BuildEditControl());

        IDictionary<string, string> Author_fieldblock = new Dictionary<string, string>();
	    Author_fieldblock["begin"] = "<input type=\"Hidden\" name=\"asearchfield[]\" value=\"Author\">";
	    Author_fieldblock["end"]=string.Empty;
	    smarty.Add("Author_fieldblock", Author_fieldblock);

        string Author_notbox="name=\"not_Author\"";
        if(not)
        {
	        Author_notbox +=" checked";
        }
        smarty.Add("Author_notbox",Author_notbox);

        //	write search options
        options = options.Remove(0, options.Length);
                options.Append("<OPTION VALUE=\"Contains\" " + ((opt=="Contains")?"selected":"") + ">" + "Contains" + "</option>");
        options.Append("<OPTION VALUE=\"Equals\" " + ((opt=="Equals")?"selected":"") + ">" + "Equals" + "</option>");
        options.Append("<OPTION VALUE=\"Starts with ...\" " + ((opt=="Starts with ...")?"selected":"") + ">" + "Starts with ..." + "</option>");
        options.Append("<OPTION VALUE=\"More than ...\" " + ((opt=="More than ...")?"selected":"") + ">" + "More than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Less than ...\" " + ((opt=="Less than ...")?"selected":"") + ">" + "Less than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Equal or more than ...\" " + ((opt=="Equal or more than ...")?"selected":"") + ">" + "Equal or more than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Equal or less than ...\" " + ((opt=="Equal or less than ...")?"selected":"") + ">" + "Equal or less than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Between\" " + ((opt=="Between")?"selected":"") + ">" + "Between" + "</option>");
        options.Append("<OPTION VALUE=\"Empty\" " + ((opt=="Empty")?"selected":"") + ">" + "Empty" + "</option>");
        searchtype = "<SELECT ID=\"SearchOption\" NAME=\"asearchopt_Author\" SIZE=1 onChange=\"return ShowHideControls();\">";
        searchtype += options.ToString();
        searchtype += "</SELECT>";
        smarty.Add("searchtype_Author", searchtype);
        //	edit format
                editformats["Author"] = "Text field";
        // Hot 
        opt = "";
        not = false;
        value = string.Empty;
        searchtype = string.Empty;
        if(Search == 2)
        {
	        opt = Asearchopt["Hot"];
	        not = Asearchnot["Hot"];
	        value = Asearchfor["Hot"];
        }

        Control control_Hot = null;
        Control control1_Hot = null;

        control_Hot = new Control("Hot", value, false, smarty, this.Request, builder, MODE.MODE_SEARCH);
        
        smarty.Add("Hot_editcontrol", control_Hot.BuildEditControl());
        control1_Hot = new Control("Hot", value, true, smarty, this.Request, builder, MODE.MODE_SEARCH);
                smarty.Add("Hot_editcontrol1", control1_Hot.BuildEditControl());

        IDictionary<string, string> Hot_fieldblock = new Dictionary<string, string>();
	    Hot_fieldblock["begin"] = "<input type=\"Hidden\" name=\"asearchfield[]\" value=\"Hot\">";
	    Hot_fieldblock["end"]=string.Empty;
	    smarty.Add("Hot_fieldblock", Hot_fieldblock);

        string Hot_notbox="name=\"not_Hot\"";
        if(not)
        {
	        Hot_notbox +=" checked";
        }
        smarty.Add("Hot_notbox",Hot_notbox);

        //	write search options
        options = options.Remove(0, options.Length);
                options.Append("<OPTION VALUE=\"Equals\" " + ((opt=="Equals")?"selected":"") + ">" + "Equals" + "</option>");
        searchtype = "<SELECT ID=\"SearchOption\" NAME=\"asearchopt_Hot\" SIZE=1 onChange=\"return ShowHideControls();\">";
        searchtype += options.ToString();
        searchtype += "</SELECT>";
        smarty.Add("searchtype_Hot", searchtype);
        //	edit format
                editformats["Hot"] = "Lookup wizard";
        // CreatedDate 
        opt = "";
        not = false;
        value = string.Empty;
        searchtype = string.Empty;
        if(Search == 2)
        {
	        opt = Asearchopt["CreatedDate"];
	        not = Asearchnot["CreatedDate"];
	        value = Asearchfor["CreatedDate"];
        }

        Control control_CreatedDate = null;
        Control control1_CreatedDate = null;

        control_CreatedDate = new Control("CreatedDate", value, false, smarty, this.Request, builder, MODE.MODE_SEARCH);
        
        smarty.Add("CreatedDate_editcontrol", control_CreatedDate.BuildEditControl());
        control1_CreatedDate = new Control("CreatedDate", value, true, smarty, this.Request, builder, MODE.MODE_SEARCH);
                smarty.Add("CreatedDate_editcontrol1", control1_CreatedDate.BuildEditControl());

        IDictionary<string, string> CreatedDate_fieldblock = new Dictionary<string, string>();
	    CreatedDate_fieldblock["begin"] = "<input type=\"Hidden\" name=\"asearchfield[]\" value=\"CreatedDate\">";
	    CreatedDate_fieldblock["end"]=string.Empty;
	    smarty.Add("CreatedDate_fieldblock", CreatedDate_fieldblock);

        string CreatedDate_notbox="name=\"not_CreatedDate\"";
        if(not)
        {
	        CreatedDate_notbox +=" checked";
        }
        smarty.Add("CreatedDate_notbox",CreatedDate_notbox);

        //	write search options
        options = options.Remove(0, options.Length);
                options.Append("<OPTION VALUE=\"Equals\" " + ((opt=="Equals")?"selected":"") + ">" + "Equals" + "</option>");
        options.Append("<OPTION VALUE=\"More than ...\" " + ((opt=="More than ...")?"selected":"") + ">" + "More than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Less than ...\" " + ((opt=="Less than ...")?"selected":"") + ">" + "Less than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Equal or more than ...\" " + ((opt=="Equal or more than ...")?"selected":"") + ">" + "Equal or more than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Equal or less than ...\" " + ((opt=="Equal or less than ...")?"selected":"") + ">" + "Equal or less than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Between\" " + ((opt=="Between")?"selected":"") + ">" + "Between" + "</option>");
        options.Append("<OPTION VALUE=\"Empty\" " + ((opt=="Empty")?"selected":"") + ">" + "Empty" + "</option>");
        searchtype = "<SELECT ID=\"SearchOption\" NAME=\"asearchopt_CreatedDate\" SIZE=1 onChange=\"return ShowHideControls();\">";
        searchtype += options.ToString();
        searchtype += "</SELECT>";
        smarty.Add("searchtype_CreatedDate", searchtype);
        //	edit format
                editformats["CreatedDate"] = "Date";
        // UpdatedDate 
        opt = "";
        not = false;
        value = string.Empty;
        searchtype = string.Empty;
        if(Search == 2)
        {
	        opt = Asearchopt["UpdatedDate"];
	        not = Asearchnot["UpdatedDate"];
	        value = Asearchfor["UpdatedDate"];
        }

        Control control_UpdatedDate = null;
        Control control1_UpdatedDate = null;

        control_UpdatedDate = new Control("UpdatedDate", value, false, smarty, this.Request, builder, MODE.MODE_SEARCH);
        
        smarty.Add("UpdatedDate_editcontrol", control_UpdatedDate.BuildEditControl());
        control1_UpdatedDate = new Control("UpdatedDate", value, true, smarty, this.Request, builder, MODE.MODE_SEARCH);
                smarty.Add("UpdatedDate_editcontrol1", control1_UpdatedDate.BuildEditControl());

        IDictionary<string, string> UpdatedDate_fieldblock = new Dictionary<string, string>();
	    UpdatedDate_fieldblock["begin"] = "<input type=\"Hidden\" name=\"asearchfield[]\" value=\"UpdatedDate\">";
	    UpdatedDate_fieldblock["end"]=string.Empty;
	    smarty.Add("UpdatedDate_fieldblock", UpdatedDate_fieldblock);

        string UpdatedDate_notbox="name=\"not_UpdatedDate\"";
        if(not)
        {
	        UpdatedDate_notbox +=" checked";
        }
        smarty.Add("UpdatedDate_notbox",UpdatedDate_notbox);

        //	write search options
        options = options.Remove(0, options.Length);
                options.Append("<OPTION VALUE=\"Equals\" " + ((opt=="Equals")?"selected":"") + ">" + "Equals" + "</option>");
        options.Append("<OPTION VALUE=\"More than ...\" " + ((opt=="More than ...")?"selected":"") + ">" + "More than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Less than ...\" " + ((opt=="Less than ...")?"selected":"") + ">" + "Less than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Equal or more than ...\" " + ((opt=="Equal or more than ...")?"selected":"") + ">" + "Equal or more than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Equal or less than ...\" " + ((opt=="Equal or less than ...")?"selected":"") + ">" + "Equal or less than ..." + "</option>");
        options.Append("<OPTION VALUE=\"Between\" " + ((opt=="Between")?"selected":"") + ">" + "Between" + "</option>");
        options.Append("<OPTION VALUE=\"Empty\" " + ((opt=="Empty")?"selected":"") + ">" + "Empty" + "</option>");
        searchtype = "<SELECT ID=\"SearchOption\" NAME=\"asearchopt_UpdatedDate\" SIZE=1 onChange=\"return ShowHideControls();\">";
        searchtype += options.ToString();
        searchtype += "</SELECT>";
        smarty.Add("searchtype_UpdatedDate", searchtype);
        //	edit format
                editformats["UpdatedDate"] = "Date";
    }

    protected void BuildBody()
    {
        string linkdata="";

        linkdata += "<script type=\"text/javascript\">\r\n";
        object value = null;
        if(Asearchfor.ContainsKey(""))
        {
            value = Asearchfor[""] ;
        }
        object fvalue = null;
        if(Asearchfor.ContainsKey("ArtID"))
        {
            fvalue = Asearchfor["ArtID"];
        }

        if (useAJAX) 
        {
            Smarty.Table tableInfo = null;
            Smarty.Field fieldInfo = null;
            List<Smarty.LookupField> lookups = null;
            string txt = ""; 

        }
        else
        {
        }
        linkdata += "</script>\r\n";


        IDictionary<string, object> body = new Dictionary<string, object>();
        body["begin"] = GetIncludes();
        body["end"] = linkdata + "<script>ShowHideControls()</script>";
        smarty.Add("body", body);

        IDictionary<string, object> contents_block = new Dictionary<string, object>();
        contents_block["begin"]="<form method=\"POST\"";
                contents_block["begin"] += "action=\"article_list.aspx\"" ;
        contents_block["begin"] += "name=\"editform\"><input type=\"hidden\" id=\"a\" name=\"a\" value=\"advsearch\">";
        contents_block["end"] ="</form>";
        smarty.Add("contents_block",contents_block);

        smarty.Add("searchbutton_attrs","name=\"SearchButton\" onclick=\"javascript:document.forms.editform.submit();\"");
        smarty.Add("resetbutton_attrs","onclick=\"return ResetControls();\"");
        smarty.Add("backbutton_attrs","onclick=\"javascript: document.forms.editform.a.value='return'; document.forms.editform.submit();\"");
        smarty.Add("conditions_block",true);
        smarty.Add("search_button",true);
        smarty.Add("reset_button",true);
        smarty.Add("back_button",true);
    }

        private bool CheckSecurity()
    {
        if(string.IsNullOrEmpty(UserName))
        { 
            MyUrl = this.Request.AppRelativeCurrentExecutionFilePath;
            this.Server.Transfer("~/admin/login.aspx?message=expired");
	        return false;
        }
                if(!BaseCheckSecurity(OwnerID, "Search"))
        {
                }
        return true;
    }

    private string Asearchtype
    {
        get
        {
            return (string)SessionPropertyGet("type", string.Empty);
        }
        set
        {
            SessionPropertySet("type", value);
        }
    }
    
    private int Search
    {
        get
        {
            return (int)SessionPropertyGet(strTableName + "_search", -1);
        }
        set
        {
            SessionPropertySet(strTableName + "_search", value);
        }
    }

    private IDictionary<string, string> Asearchopt
    {
        get
        {
            return (IDictionary<string, string>)SessionPropertyGet(strTableName + "_asearchopt", new Dictionary<string, string>());
        }
        set
        {
            SessionPropertySet(strTableName + "_asearchopt", value);
        }
    }

    private IDictionary<string, bool> Asearchnot
    {
        get
        {
            return (IDictionary<string, bool>)SessionPropertyGet(strTableName + "_asearchnot", new Dictionary<string, bool>());
        }
        set
        {
            SessionPropertySet(strTableName + "_asearchnot", value);
        }
    }

    private IDictionary<string, string> Asearchfor
    {
        get
        {
            return (IDictionary<string, string>)SessionPropertyGet(strTableName + "_asearchfor", new Dictionary<string, string>());
        }
        set
        {
            SessionPropertySet(strTableName + "_asearchfor", value);
        }
    }

    private string Mastertable
    {
        get
        {
            return (string)SessionPropertyGet(strTableName + "_mastertable", string.Empty);
        }
        set
        {
            SessionPropertySet(strTableName + "_mastertable", value);
        }
    }
}
